package com.sharkburner.common.component;

import com.vaadin.ui.Layout;
import com.vaadin.ui.VerticalLayout;

/**
 * 
 * @author inartea
 * 
 */
public class BodyComposition extends VerticalLayout {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3075696383085803928L;

	private MenuBar menuBar;
	private Layout mainLayout;
	private StatusBar statusBar;

	public BodyComposition() {
		menuBar = new MenuBar();
		statusBar = new StatusBar();
		mainLayout = new VerticalLayout();

		buildMainLayout();
	}

	public BodyComposition(Layout composition) {
		this();
		this.mainLayout = composition;
	}

	public BodyComposition(MenuBar menuBar, Layout composition,
			StatusBar statusBar) {
		this(composition);
		this.menuBar = menuBar;
		this.statusBar = statusBar;
	}

	private void buildMainLayout() {
		// the main layout and components will be created here
		addComponent(menuBar);
		addComponent(mainLayout);
		addComponent(statusBar);
	}

	public MenuBar getMenuBar() {
		return menuBar;
	}

	public void setMenuBar(MenuBar menuBar) {
		this.menuBar = menuBar;
	}

	public Layout getBody() {
		return mainLayout;
	}

	public void setBody(Layout body) {
		mainLayout.removeAllComponents();

		mainLayout.addComponent(body);
	}

	public StatusBar getStatusBar() {
		return statusBar;
	}

	public void setStatusBar(StatusBar statusBar) {
		this.statusBar = statusBar;
	}
}
